/** 
 * PushbackSupport.java
 * @author Lex
 * 2007-8-18 ����05:25:34
 */
package fun.parser.util;

/*
 * ��ô�о������Ĺ��ܺ�Stackһ��...
 */
public class PushbackSupport<T> {
    private Object[] buffer = null;
    private int pos = -1;

    public PushbackSupport(int bufsize) {
	this.buffer = new Object[bufsize];
    }

    public boolean isEmpty() {
	return pos < 0;
    }

    @SuppressWarnings("unchecked")
    public T get() {
	return (T) buffer[pos--];
    }

    public void pushback(T value) {
	buffer[++pos] = value;
    }
}
